Imports Microsoft.VisualBasic

Public Class DataClassesDesigner

    Private mProjectID As Integer
    Private mDatabaseName As String

    Public Sub New(ByVal ProjectID As Integer, ByVal DatabaseName As String)
        mProjectID = ProjectID
        mDatabaseName = DatabaseName
    End Sub

    Private Function GetHeader() As String
        Dim Output As String = ""
        Output = Output & "    '------------------------------------------------------------------------------" & vbCrLf
        Output = Output & "    ' <auto-generated>" & vbCrLf
        Output = Output & "    '     This code was generated by a tool." & vbCrLf
        Output = Output & "    '     Runtime Version:2.0.50727.1433" & vbCrLf
        Output = Output & "    '" & vbCrLf
        Output = Output & "    '     Changes to this file may cause incorrect behavior and will be lost if" & vbCrLf
        Output = Output & "    '     the code is regenerated." & vbCrLf
        Output = Output & "    ' </auto-generated>" & vbCrLf
        Output = Output & "    '------------------------------------------------------------------------------" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "Option Strict On" & vbCrLf
        Output = Output & "Option Explicit On" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "Imports System" & vbCrLf
        Output = Output & "Imports System.Collections.Generic" & vbCrLf
        Output = Output & "Imports System.ComponentModel" & vbCrLf
        Output = Output & "Imports System.Data" & vbCrLf
        Output = Output & "Imports System.Data.Linq" & vbCrLf
        Output = Output & "Imports System.Data.Linq.Mapping" & vbCrLf
        Output = Output & "Imports System.Linq" & vbCrLf
        Output = Output & "Imports System.Linq.Expressions" & vbCrLf
        Output = Output & "Imports System.Reflection" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "    <System.Data.Linq.Mapping.DatabaseAttribute(Name:=""" & mDatabaseName & """)> _" & vbCrLf
        Output = Output & "    Partial Public Class DataClassesDataContext" & vbCrLf
        Output = Output & "        Inherits System.Data.Linq.DataContext" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "        Private Shared mappingSource As System.Data.Linq.Mapping.MappingSource = New AttributeMappingSource" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "#Region ""Extensibility Method Definitions""" & vbCrLf
        Output = Output & "        Partial Private Sub OnCreated()" & vbCrLf
        Output = Output & "        End Sub" & vbCrLf
        Output = Output & "#End Region" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "        Public Sub New()" & vbCrLf
        Output = Output & "            MyBase.New(Global.System.Configuration.ConfigurationManager.ConnectionStrings(""TestConnectionString"").ConnectionString, mappingSource)" & vbCrLf
        Output = Output & "            OnCreated()" & vbCrLf
        Output = Output & "        End Sub" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "        Public Sub New(ByVal connection As String)" & vbCrLf
        Output = Output & "            MyBase.New(connection, mappingSource)" & vbCrLf
        Output = Output & "            OnCreated()" & vbCrLf
        Output = Output & "        End Sub" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "        Public Sub New(ByVal connection As System.Data.IDbConnection)" & vbCrLf
        Output = Output & "            MyBase.New(connection, mappingSource)" & vbCrLf
        Output = Output & "            OnCreated()" & vbCrLf
        Output = Output & "        End Sub" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "        Public Sub New(ByVal connection As String, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource)" & vbCrLf
        Output = Output & "            MyBase.New(connection, mappingSource)" & vbCrLf
        Output = Output & "            OnCreated()" & vbCrLf
        Output = Output & "        End Sub" & vbCrLf
        Output = Output & "" & vbCrLf
        Output = Output & "        Public Sub New(ByVal connection As System.Data.IDbConnection, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource)" & vbCrLf
        Output = Output & "            MyBase.New(connection, mappingSource)" & vbCrLf
        Output = Output & "            OnCreated()" & vbCrLf
        Output = Output & "        End Sub" & vbCrLf
        Output = Output & "" & vbCrLf
        Return Output
    End Function

End Class
